<template>
	<view>
		<anil-seat :title="chooseMovice.movieName"
			:info="chooseMovice.type +'	'+ plan.showVersionType+ '	'+ plan.startTime+ '-'+ plan.endTime"
			:room-name="plan.hallName" :seat-data="seatData" :max="4" @confirm="onConfirmSeat" v-if="seatData.length>0">
		</anil-seat>
		<div class="mt50" v-else>
			<u-empty text="暂无场次,换个时间试试吧" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
			</u-empty>
		</div>
		<u-loading-page :loading="loading"></u-loading-page>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				seatData: [],
				showId: '',
				chooseMovice: {},
				plan: {},
				loading: true,
				userInfo: '',
				phone:''
			};
		},
		onLoad(e) {
			this.showId = e.showId
			this.chooseMovice = uni.getStorageSync('chooseMovice')
			this.plan = uni.getStorageSync('plan')
			this.loading = true
			this.userInfo = uni.getStorageSync('uInfo')
			if (this.userInfo) {
				this.phone=this.userInfo.phone
			}
			this.getSeatMap()
		},
		methods: {
			// 查询电影院的详细信息（电影场次信息等）
			getSeatMap() {
				this.$http('/api/getSeatMap', {
					showId: this.showId,
					phone: this.phone,
				}).then((r) => {
					this.seatData = r.data
					this.loading = false
				})
			},
			onConfirmSeat(items) {
				console.log(items)
				uni.setStorageSync('seats', items)
				this.openPage('../fuKuan/fuKuan?showId=' + this.showId)
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f1f1f5;
		height: 100%;
	}
</style>